#include <algorithm>
#include <iostream>
#include <vector>

/**
 * NowCoder KY106 Submatrix with Minimum Area
 */

int main() {
    // Read matrix and compute row sum
    int nRow, nCol, k;
    scanf("%d %d %d", &nRow, &nCol, &k);
    std::vector<std::vector<int> > mat(nRow, std::vector<int>(nCol)),
        rowSum(nRow + 1, std::vector<int>(nCol, 0));
    for (int i = 0; i < nRow; i++) {
        for (int j = 0; j < nCol; j++) {
            scanf("%d", &mat[i][j]);
            rowSum[i + 1][j] = rowSum[i][j] + mat[i][j];
        }
    }

    // Find submatrix
    int minArea = INT32_MAX;
    for (int rBeg = 0; rBeg < nRow; rBeg++) {
        for (int rEnd = rBeg + 1; rEnd <= nRow; rEnd++) {
            // Compute sum of rows between two indices
            std::vector<int> sum(nCol);
            for (int i = 0; i < nCol; i++)
                sum[i] = rowSum[rEnd][i] - rowSum[rBeg][i];

            // Use two-pointer method to find minimum area
            int cBegin = 0, cEnd = 1;
            int cSum = sum[cBegin];
            while (cBegin < nCol) {
                if (cSum < k && cEnd < nCol) {
                    cSum += sum[cEnd];
                    cEnd++;
                    continue;
                }
                if (cSum >= k) {  // cSum >= k
                    int area = (rEnd - rBeg) * (cEnd - cBegin);
                    minArea = std::min(area, minArea);
                }
                cSum -= sum[cBegin];
                cBegin++;
            }
        }
    }
    printf("%d\n", minArea == INT32_MAX ? -1 : minArea);

    return 0;
}